home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue66 / SQLComp / DMSQLIBX.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-09-20  |  1.1 KB  |  56 lines

  1. unit DMSQLIBX;
  2.  
  3. interface
  4.  
  5. uses
  6.   Classes, DMSQLBase, IBQuery;
  7.  
  8. type
  9.   // An InterBase query that can change its where clause.
  10.   TDMSQLIBQuery = class(TIBQuery, IDMSQLQuery)
  11.   private
  12.     FImplementor: TDMSQLQueryImpl;
  13.     procedure AfterBuild(Sender: TDMSQLQueryImpl);
  14.     procedure BeforeBuild(Sender: TDMSQLQueryImpl);
  15.     procedure SetSQLText(Value: string);
  16.   protected
  17.     procedure Loaded; override;
  18.   public
  19.     constructor Create(AOwner: TComponent); override;
  20.   published
  21.     property Implementor: TDMSQLQueryImpl read FImplementor write FImplementor;
  22.   end;
  23.  
  24. implementation
  25.  
  26. { TDMSQLIBQuery }
  27.  
  28. constructor TDMSQLIBQuery.Create(AOwner: TComponent);
  29. begin
  30.   inherited;
  31.   FImplementor := TDMSQLQueryImpl.Create(Self);
  32. end;
  33.  
  34. procedure TDMSQLIBQuery.BeforeBuild(Sender: TDMSQLQueryImpl);
  35. begin
  36. end;
  37.  
  38. procedure TDMSQLIBQuery.AfterBuild(Sender: TDMSQLQueryImpl);
  39. begin
  40.   if sqlOpenAfterBuild in Sender.SQLOptions then
  41.     Open;
  42. end;
  43.  
  44. procedure TDMSQLIBQuery.Loaded;
  45. begin
  46.   inherited;
  47.   FImplementor.BaseSQL := SQL;
  48. end;
  49.  
  50. procedure TDMSQLIBQuery.SetSQLText(Value: string);
  51. begin
  52.   SQL.Text := Value;
  53. end;
  54.  
  55. end.
  56.